<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tab with Table</title>
<style>
    .tab {
        display: none;
    }

    .tab.active {
        display: block;
    }
</style>
</head>
<body>

<div class="tabs">
    <button class="tab-btn" onclick="openTab('tab1')">Tab 1</button>
    <button class="tab-btn" onclick="openTab('tab2')">Tab 2</button>
</div>

<div id="tab1" class="tab active">
    <table id="table1">
        <tr>
            <th>Header 1</th>
            <th>Header 2</th>
            <th>Action</th>
        </tr>
        <tr>
            <td>Data 1</td>
            <td>Data 2</td>
            <td><button onclick="deleteRow(this)">Delete</button></td>
        </tr>
    </table>
</div>

<div id="tab2" class="tab">
    <table id="table2">
        <!-- Add your table data here -->
    </table>
</div>

<script>
    function openTab(tabName) {
        var tabs = document.getElementsByClassName('tab');
        for (var i = 0; i < tabs.length; i++) {
            tabs[i].classList.remove('active');
        }
        document.getElementById(tabName).classList.add('active');
    }

    function deleteRow(btn) {
        var row = btn.parentNode.parentNode;
        row.parentNode.removeChild(row);
    }
</script>

</body>
</html>
